refactor: extract duplicate backoff delay calc into _backoff_seconds helper - #811
Merged
anderdc merged 2 commits intoApr 30, 2026
Merged
Conversation
wdeveloper16
force-pushed
the
refactor/extract-backoff-seconds-helper
branch
9 times, most recently
from
April 29, 2026 20:21
374d9d7 to
99878b5
Compare
anderdc
requested changes
Apr 29, 2026
anderdc
left a comment
Collaborator
There was a problem hiding this comment.
Same formula lives in gittensor/utils/mirror/client.py:106 and :123 — both min(5 * (2**attempt), 30), identical to most call sites here. Pull those in too. Move the helper to gittensor/utils/utils.py (next to parse_repo_name) and drop the leading underscore so both files import it from there — avoids a mirror→github_api_tools dependency and keeps it where shared utilities already live.
The linear 2 * (attempt + 1) at github_api_tools.py:567 and the time.sleep(2**attempt) in neurons/base/neuron.py:147 are different shapes — leave alone.
Contributor
Author
|
Thanks for your review, Fair point. |
wdeveloper16
force-pushed
the
refactor/extract-backoff-seconds-helper
branch
2 times, most recently
from
April 29, 2026 20:38
fa7ef66 to
cfc6ffe
Compare
wdeveloper16
force-pushed
the
refactor/extract-backoff-seconds-helper
branch
from
April 29, 2026 20:40
cfc6ffe to
eb41369
Compare
Contributor
Author
|
Just done! |
wdeveloper16
force-pushed
the
refactor/extract-backoff-seconds-helper
branch
from
April 29, 2026 21:44
eb41369 to
081e0b1
Compare
anderdc
approved these changes
Apr 30, 2026
plind-junior
added a commit
to plind-junior/gittensor
that referenced
this pull request
Apr 30, 2026
…lper - Restore additional_acceptable_branches dropped during rebase (jupyterlab, FastGPT, monero, nextcloud/desktop, nextcloud/server, zed) — added upstream in entrius#831 and lost when this branch was based on a stale snapshot. - Add entrius/das-github-mirror at weight 0.2 with trusted_label_pipeline (deliverable entrius#4 from issue entrius#911). - Inline _label_actor_trusted into _resolve_maintainer_set_label per the codebase's single-use-helper convention (entrius#818/entrius#811/entrius#801); drop the now-redundant TestLabelActorTrusted truth table since coverage lives in TestLabelResolution end-to-end.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #810
Summary
min(5 * (2**attempt), 30)(and two variants) was copy-pasted across 9 call sites ingithub_api_tools.py_backoff_seconds(attempt, base=5, cap=30)helper that encodes the formula onceget_merge_base_sha,get_pull_request_file_changes,execute_graphql_query,get_github_graphql_query) updated — no behaviour changeTest plan